﻿using Microsoft.AspNetCore.Components;
using System.Diagnostics.CodeAnalysis;

namespace Swimj.RazorLib.Partials
{
    public partial class TablePartialColumn<T> : ComponentBase
    {
        [Parameter]
        [NotNull]
        public string? Field { get; set; }

        [CascadingParameter] public SearchTablePartial<T>? ParentDataGrid { get; set; }

        [Parameter]
        public RenderFragment<T>? ChildContent { get; set; }

        protected override void OnInitialized()
        {
            base.OnInitialized();

            if (ParentDataGrid is not null)
            {
                ParentDataGrid.AddColumn(this);
            }
        }

    }
}
